home *** CD-ROM | disk | FTP | other *** search
/ Programming in Microsoft Windows with C# / Programacion en Microsoft Windows con C#.iso / Codigo / Vista en árbol y vista en lista / OnePanelWithSplitter / OnePanelWithSplitter.cs next >
Encoding:
Text File  |  2002-05-22  |  1.2 KB  |  42 lines

  1. //---------------------------------------------------
  2. // OnePanelWithSplitter.cs ⌐ 2001 by Charles Petzold
  3. //---------------------------------------------------
  4. using System;
  5. using System.Drawing;
  6. using System.Windows.Forms;
  7.  
  8. class OnePanelWithSplitter: Form
  9. {
  10.      public static void Main()
  11.      {
  12.           Application.Run(new OnePanelWithSplitter());
  13.      }
  14.      public OnePanelWithSplitter()
  15.      {
  16.           Text = "Un panel con divisi≤n";
  17.  
  18.           Splitter split  = new Splitter();
  19.           split.Parent    = this;
  20.           split.Dock      = DockStyle.Left;
  21.  
  22.           Panel panel     = new Panel();
  23.           panel.Parent    = this;
  24.           panel.Dock      = DockStyle.Left;
  25.           panel.BackColor = Color.Lime;
  26.           panel.Resize   += new EventHandler(PanelOnResize);
  27.           panel.Paint    += new PaintEventHandler(PanelOnPaint);
  28.      }
  29.      void PanelOnResize(object obj, EventArgs ea)
  30.      {
  31.           ((Panel) obj).Invalidate();
  32.      }
  33.      void PanelOnPaint(object obj, PaintEventArgs pea)
  34.      {
  35.           Panel    panel = (Panel) obj;
  36.           Graphics grfx  = pea.Graphics;
  37.  
  38.           grfx.DrawEllipse(Pens.Black, 0, 0, 
  39.                            panel.Width - 1, panel.Height - 1);
  40.      }
  41. }
  42.